﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Southridge.Data
{
    public class Listing : BusinessEntity 
    {
        protected string _MLS;
        public string MLS
        {
            get
            {
                return _MLS;
            }
            set
            {
                if (_MLS != value)
                {
                    _MLS = value;
                    OnPropertyChanged("MLS");
                }
            }
        }

        protected string _Title;
        public string Title
        {
            get
            {
                return _Title;
            }
            set
            {
                if (_Title != value)
                {
                    _Title = value;
                    OnPropertyChanged("Title");
                }
            }
        }
        protected string _Description;
        public string Description
        {
            get
            {
                return _Description;
            }
            set
            {
                if (_Description != value)
                {
                    _Description = value;
                    OnPropertyChanged("Description");
                }
            }
        }


        protected int _BedroomCount;
        public int BedroomCount
        {
            get
            {
                return _BedroomCount;
            }
            set
            {
                if (_BedroomCount != value)
                {
                    _BedroomCount = value;
                    OnPropertyChanged("BedroomCount");
                }
            }
        }

        protected double _BathroomCount;
        public double BathroomCount
        {
            get
            {
                return _BathroomCount;
            }
            set
            {
                if (_BathroomCount != value)
                {
                    _BathroomCount = value;
                    OnPropertyChanged("BathroomCount");
                }
            }
        }

        protected string _Address1;
        public string Address1
        {
            get
            {
                return _Address1;
            }
            set
            {
                if (_Address1 != value)
                {
                    _Address1 = value;
                    OnPropertyChanged("Address1");
                }
            }
        }

        protected string _Address2;
        public string Address2
        {
            get
            {
                return _Address2;
            }
            set
            {
                if (_Address2 != value)
                {
                    _Address2 = value;
                    OnPropertyChanged("Address2");
                }
            }
        }


        protected string _City;
        public string City
        {
            get
            {
                return _City;
            }
            set
            {
                if (_City != value)
                {
                    _City = value;
                    OnPropertyChanged("City");
                }
            }
        }
        protected string _ZipCode;
        public string ZipCode
        {
            get
            {
                return _ZipCode;
            }
            set
            {
                if (_ZipCode != value)
                {
                    _ZipCode = value;
                    OnPropertyChanged("ZipCode");
                }
            }
        }


        protected float _Price;
        public float Price
        {
            get
            {
                return _Price;
            }
            set
            {
                if (_Price != value)
                {
                    _Price = value;
                    OnPropertyChanged("Price");
                }
            }
        }

        protected int _Year;
        public int Year
        {
            get
            {
                return _Year;
            }
            set
            {
                if (_Year != value)
                {
                    _Year = value;
                    OnPropertyChanged("Year");
                }
            }
        }

        protected int _SquareFootage;
        public int SquareFootage
        {
            get
            {
                return _SquareFootage;
            }
            set
            {
                if (_SquareFootage != value)
                {
                    _SquareFootage = value;
                    OnPropertyChanged("SquareFootage");
                }
            }
        }

        protected DateTime _DatePosted;
        public DateTime DatePosted
        {
            get
            {
                return _DatePosted;
            }
            set
            {
                if (_DatePosted != value)
                {
                    _DatePosted = value;
                    OnPropertyChanged("DatePosted");
                }
            }
        }

        protected DateTime _CreationDate;
        public DateTime CreationDate
        {
            get
            {
                return _CreationDate;
            }
            set
            {
                if (_CreationDate != value)
                {
                    _CreationDate = value;
                    OnPropertyChanged("CreationDate");
                }
            }
        }

        protected DateTime _DateLastUpdated;
        public DateTime DateLastUpdated
        {
            get
            {
                return _DateLastUpdated;
            }
            set
            {
                if (_DateLastUpdated != value)
                {
                    _DateLastUpdated = value;
                    OnPropertyChanged("DateLastUpdated");
                }
            }
        }

        protected int _ClientRating;
        public int ClientRating
        {
            get
            {
                return _ClientRating;
            }
            set
            {
                if (_ClientRating != value)
                {
                    _ClientRating = value;
                    OnPropertyChanged("ClientRating");
                }
            }
        }

        protected bool _HasPhotos;
        public bool HasPhotos
        {
            get
            {
                return _HasPhotos;
            }
            set
            {
                if (_HasPhotos != value)
                {
                    _HasPhotos = value;
                    OnPropertyChanged("HasPhotos");
                }
            }
        }

        protected bool _HasAppt;
        public bool HasAppt
        {
            get
            {
                return _HasAppt;
            }
            set
            {
                if (_HasAppt != value)
                {
                    _HasAppt = value;
                    OnPropertyChanged("HasAppt");
                }
            }
        }

        protected int _NeighborhoodId;
        public int NeighborhoodId
        {
            get
            {
                return _NeighborhoodId;
            }
            set
            {
                if (_NeighborhoodId != value)
                {
                    _NeighborhoodId = value;
                    OnPropertyChanged("NeighborhoodId");
                }
            }
        }


       
        protected string _PrimaryPhoto;
        public string PrimaryPhoto
        {
            get
            {
                return _PrimaryPhoto;
            }
            set
            {
                if (_PrimaryPhoto != value)
                {
                    _PrimaryPhoto = value;
                    OnPropertyChanged("PrimaryPhoto");
                }
            }
        }

        protected State _State;
        public State State
        {
            get
            {
                return _State;
            }
            set
            {
                if (_State != value)
                {
                    _State = value;
                    OnPropertyChanged("State");
                }
            }
        }

        protected double _Latitude;
        public double Latitude
        {
            get
            {
                return _Latitude;
            }
            set
            {
                if (_Latitude != value)
                {
                    _Latitude = value;
                    OnPropertyChanged("Latitude");
                }
            }
        }


        protected double _Longitude;
        public double Longitude
        {
            get
            {
                return _Longitude;
            }
            set
            {
                if (_Longitude != value)
                {
                    _Longitude = value;
                    OnPropertyChanged("Longitude");
                }
            }
        }

        protected DateTime? _ApptDate;
        public DateTime? ApptDate
        {
            get
            {
                 
                    return _ApptDate;
            }
            set
            {
                if (_ApptDate != value)
                {
                    _ApptDate = value;
                    OnPropertyChanged("ApptDate");
                }
            }
        }


        public Neighborhood Neighborhood
        {
            get
            {
                Neighborhood ret = Database.Neighborhoods.Where((n) => n.Id == NeighborhoodId).First();
                
                return ret; 
            }
        } 
         private static int counter;
         public List<string> Images
         {
             get
             {
                 if (true || Listing.counter++ % 2 == 1)
                 {
                     return new List<string>()
                    {         
                            "pack://application:,,,/Southridge;component/sampledata/3Main.png" , 
                            "pack://application:,,,/Southridge;component/sampledata/3Bathroom.png", 
                            "pack://application:,,,/Southridge;component/sampledata/3bedroom.png" , 
                            "pack://application:,,,/Southridge;component/sampledata/3Dining.png" , 
                            "pack://application:,,,/Southridge;component/sampledata/3Chimney.png" , 
                            "pack://application:,,,/Southridge;component/sampledata/3Kitchen.png" , 
                            "pack://application:,,,/Southridge;component/sampledata/3Living.png" 
                    };

                 }
                 else
                 {
                     return new List<string>()
                    {                              
                            "pack://application:,,,/sampledata/1Main.png" , 
                            "pack://application:,,,/sampledata/1Bath.png", 
                            "pack://application:,,,/sampledata/1Closet.png" , 
                            "pack://application:,,,/sampledata/1Dining.png" , 
                            "pack://application:,,,/sampledata/1Fireplace.png" , 
                            "pack://application:,,,/sampledata/1Kitchen.png" , 
                            "pack://application:,,,/sampledata/1Living.png"   
                    };

                 }
             }
         } 

        public void SimpleSave() { } 
        //     
        // NeighborhoodId, PrimaryPhoto,  
        //     


    }
}
